<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>
        openGauss自动化性能-CI连跑分析报告
    </title>
    <style type="text/css">
            LogTitle {
                display: block;
                background-color: #b6d7a8;
                padding: 10px; }

            .modal.fade.in {
                top: 20%;
            }
            #div-component-info .table tbody tr td{
                vertical-align: middle;
            }
    </style>
</head>
<body>
{% extends 'base.html' %}
{% block body_part %}
<LogTitle><em style="font-size: 20px;"><b>性能指标</b></em><br></LogTitle>
<br>
<div class="container-fluid">
     <div class="row">
        <div class="col-md-6" style="float: left;" id="div-component-info">
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th>指标项</th>
                    <th>指标子项</th>
                    <th>指标值</th>
                    <!--<th>实际值</th>-->
                    <!--<th>是否达标</th>-->
                </tr> </thead>
                <tbody>
                <tr>
                    <td rowspan="5">TPCC</td>
                    <td>2P 单节点 1H</td>
                    <td>150w</td>
                </tr>
                <tr>
                    <td>2P 单节点 8H</td>
                    <td>150w</td>
                </tr>
                <tr>
                    <td>2P 一主一备 1H</td>
                    <td>120w</td>
                </tr>
                <tr>
                    <td>5220 单节点 1H</td>
                    <td>100w</td>
                </tr>
                <tr>
                    <td>4P 单节点 1H</td>
                    <td>230w</td>
                </tr>
                <tr>
                    <td>RTO</td>
                    <td>一主两同步备</td>
                    <td>10s</td>
                </tr>
                <tr>
                    <td rowspan="4">工具链迁移</td>
                    <td>全量迁移</td>
                    <td>300MB/s</td>
                </tr>
                <tr>
                    <td>增量迁移</td>
                    <td>3w tps</td>
                </tr>
                <tr>
                    <td>反向迁移</td>
                    <td>1w tps</td>
                </tr>
                <tr>
                    <td>全量数据校验</td>
                    <td>70MB/s</td>
                </tr>
                </tbody>
            </table>
        </div>
     </div>
    <br>
</div>

<LogTitle><em style="font-size: 20px;"><b>TPC-C执行结果</b></em></LogTitle>
<br>
<div class="container-fluid">
    <div class="row">
        <div class="col-md-6" style="float: left;">
            <div class="echarts" id="single_2p"
                     style="width: 90%; height:450px; margin: 0 auto"></div>
        </div>
        <div class="col-md-6" style="float: left;">
            <div class="echarts" id="dot"
                     style="width: 90%; height:450px; margin: 0 auto"></div>
        </div>
    </div>
</div>

<LogTitle><em style="font-size: 20px;"><b>TPC-H执行结果</b></em></LogTitle>
<div class="form-group">
    <label style="color: black;margin-left: 10px;">
        并行度:
    </label>
    <select class="form-control" name="select_form" id="query_dop_select_form">
        <option value="query_dop_1" selected>
            1
        </option>
        <option value="query_dop_64">
            64
        </option>
    </select>
</div>
<div id="div_sql_table_tpch" style="display:">
    <table id="sql_table_tpch" class="table table-hover table-bordered table-striped">
    </table>
</div>
<br>

<LogTitle><em style="font-size: 20px;"><b>SQL语句性能测试执行结果</b></em><br></LogTitle>
<br>
<div class="col-md-6" style="float: left;">
    <div class="echarts" id="sql_simple_line"
        style="width: 90%; height:450px; margin: 0 auto"></div>
</div>
<div class="col-md-6" style="float: left;">
    <div class="echarts" id="sql_yukon_line"
        style="width: 90%; height:450px; margin: 0 auto"></div>
</div>
<br>
<div class="form-group">
    <label style="color: black;margin-left: 10px;">
        执行场景:
    </label>
    <br>
    <select class="form-control" name="select_form" id="select_form">
        <option value="normal" selected>
            简单算子
        </option>
        <option value="chaotu">
            业务场景-YuKon
        </option>
    </select>
</div>
<div id="div_sql_table_normal" style="display:">
    <table id="sql_table" class="table table-hover table-bordered table-striped">
    </table>
</div>
<div id="div_sql_table_chaotu" style="display:none">
    <table id="sql_table_chaotu" class="table table-hover table-bordered table-striped">
    </table>
</div>
<br>

<LogTitle><em style="font-size: 20px;"><b>工具链执行结果</b></em><br></LogTitle>
<br>
<div id="div_trans_table_full">
    <p style="background-color:AntiqueWhite;font-family:arial;color:black;font-size:16px;font-weight:bold;padding:5px;">
        全量迁移性能（指标：300MB/s）</p>
    <table id="trans_table_full" class="table table-hover table-bordered table-striped">
    </table>
</div>
<br>
<div id="div_trans_table_incre">
    <p style="background-color:AntiqueWhite;font-family:arial;color:black;font-size:16px;font-weight:bold;padding:5px;">
        增量迁移性能（指标：3w tps）</p>
    <table id="trans_table_incre" class="table table-hover table-bordered table-striped">
    </table>
</div>
<br>
<div id="div_trans_table_reverse">
    <p style="background-color:AntiqueWhite;font-family:arial;color:black;font-size:16px;font-weight:bold;padding:5px;">
        反向迁移性能（指标：1w tps）</p>
    <table id="trans_table_reverse" class="table table-hover table-bordered table-striped">
    </table>
</div>
<br>
<div id="div_trans_table_datacheck">
    <p style="background-color:AntiqueWhite;font-family:arial;color:black;font-size:16px;font-weight:bold;padding:5px;">
        全量数据校验性能（指标：70MB/s）</p>
    <table id="trans_table_datacheck" class="table table-hover table-bordered table-striped">
    </table>
</div>
<br>

<script type="text/javascript">
    $('#select_form').change(function(data){
            //获取选中项的值
            var value = $("#select_form option:selected").attr("value");
            var table_normal=document.getElementById("div_sql_table_normal");
            var table_chaotu=document.getElementById("div_sql_table_chaotu");
            //输出日志
            console.log("value=%s",value);
            if(value=="normal"){
                table_normal.style.display="";
                table_chaotu.style.display="none";
            }else if(value=="chaotu"){
                table_normal.style.display="none";
                table_chaotu.style.display="";
            }
    });

    $(document).ready(function(){
        $('#query_dop_select_form').change(function(data){
                var value = $("#query_dop_select_form option:selected").attr("value");
                $.get("{% url 'get_tpch_data' %}", {querydop_val: value}, function(data,status){
                    var sql_res = JSON.parse(data);
                    var new_data = sql_res['rows'];
                    for (var i = 0; i < new_data.length; i++) {
                        $('#sql_table_tpch').bootstrapTable('updateRow', {
                            index: i,
                            row: new_data[i]
                        })
                    }
                })
        });

        $.get("{% url 'perf_get_data' %}", function(data,status){
            var json_data = JSON.parse(data);
            var newLineChart = document.getElementById('single_2p');
            var myLineChart = echarts.init(newLineChart);
            var line_chart_option = {
                title: {
                    text: '七日tpmC折线图',
                    x: 'center',
                    y: 'top',
                },
                grid: {
                    top: '18%'
                },
                tooltip: {trigger: 'axis'},
                legend: {
                    x: 'right',
                    y: '7%',
                    data: ['2P_单节点_非分区表_1H', '2P_单节点_分区表_1H', '2P_一主一备_分区表_1H', '2P_一主一备_非分区表_1H',
                           '5220_单节点_1H', '4P_单节点_1H']
                },
                xAxis: {
                    name: '日期',
                    type: 'category',
                    data: json_data.x_data,
                    axisLabel: {
                        rotate: 0,
                        interval: 0
                    }
                },
                yAxis: {
                    name: 'tpmC',
                    type: 'value',
                    splitNumber: 4,
                    min: 0,
                    //minInterval: 450000,
                    max: 2400000,
                    interval: 600000,
                },
                series: [{
                    name: '2P_单节点_非分区表_1H',
                    type: 'line',
                    data: json_data.y_data[0],
                    symbolSize: 5,
                    symbol: 'circle',
                    itemStyle: {
                        normal: {
                            label: {
                                show: true,
                                position: 'bottom',
                            },
                            borderColor: 'gray',
                            color: '#5c8e26',
                            lineStyle: {
                                width: 2,
                                color: '#5c8e26'
                            }
                        }
                    }
                },
                {
                    name: '2P_单节点_分区表_1H',
                    type: 'line',
                    data: json_data.y_data[5],
                    symbolSize: 5,
                    symbol: 'circle',
                    itemStyle: {
                        normal: {
                            label: {
                                show: true,
                            },
                            borderColor: 'gray',
                            color: '#00CC00',
                            lineStyle: {
                                width: 2,
                                color: '#00CC00'
                            }
                        }
                    }
                },
                {
                    name: '2P_一主一备_分区表_1H',
                    type: 'line',
                    data: json_data.y_data[1],
                    symbolSize: 5,
                    symbol: 'circle',
                    itemStyle: {
                        normal: {
                            label: {
                                show: true
                            },
                            borderColor: 'gray',
                            color: '#4f81bd',
                            lineStyle: {
                                width: 2,
                                color: '#4f81bd'
                            }
                        }
                    }
                },
                {
                    name: '2P_一主一备_非分区表_1H',
                    type: 'line',
                    data: json_data.y_data[2],
                    symbolSize: 5,
                    symbol: 'circle',
                    itemStyle: {
                        normal: {
                            label: {
                                show: true,
                                position: 'bottom',
                            },
                            borderColor: 'gray',
                            color: '#00BBFF',
                            lineStyle: {
                                width: 2,
                                color: '#00BBFF'
                            }
                        }
                    }
                },
                {
                    name: '5220_单节点_1H',
                    type: 'line',
                    data: json_data.y_data[3],
                    symbolSize: 5,
                    symbol: 'circle',
                    itemStyle: {
                        normal: {
                            label: {
                                show: true
                            },
                            borderColor: 'gray',
                            color: '#8A2BE2',
                            lineStyle: {
                                width: 2,
                                color: '#8A2BE2'
                            }
                        }
                    }
                },
                {
                    name: '4P_单节点_1H',
                    type: 'line',
                    data: json_data.y_data[4],
                    symbolSize: 5,
                    symbol: 'circle',
                    itemStyle: {
                        normal: {
                            label: {
                                show: true
                            },
                            borderColor: 'gray',
                            color: '#FFDAB9',
                            lineStyle: {
                                width: 2,
                                color: '#FFDAB9'
                            }
                        }
                    }
                }]
            };
            myLineChart.setOption(line_chart_option);

            dot_res = json_data.dot_data
            var dotLineChart = document.getElementById('dot');
            var myDotChart = echarts.init(dotLineChart);
            var dot_x = []
            for (var i = 0; i < dot_res[0][6].length; i++) {
                dot_x.push((i+1).toString())
            }
            var dot_y = new Array(dot_x.length).fill(0)
            var dot_chart_option = {
                title: {
                    text: 'tpmC波动图',
                    x: 'center',
                    y: 'top',
                },
                grid: {
                    top: '18%'
                },
                tooltip: {trigger: 'axis'},
                legend: {
                    x: 'right',
                    y: '7%',
                    data: ['2P_单节点_非分区表_1H', '2P_单节点_分区表_1H', '2P_一主一备_分区表_1H', '2P_一主一备_非分区表_1H',
                           '5220_单节点_1H', '4P_单节点_1H']
                },
                xAxis: {
	            show: false,
                    name: '时间',
                    type: 'category',
                    data: dot_x,
                    axisLabel: {
                        rotate: 90,
                        interval: 0
                    }
                },
                yAxis: {
                    name: 'tpmC',
                    type: 'value',
                    min: 0,
                    minInterval: 1,
                    max: 2500000
                },
                series: [{
                    name: '2P_单节点_非分区表_1H',
                    type: 'line',
                    data: dot_res[0][6],
                    symbolSize: 5,
                    symbol: 'none',
                    itemStyle: {
                        normal: {
                            label: {
                                show: true
                            },
                            borderColor: 'gray',
                            color: '#5c8e26',
                            lineStyle: {
                                width: 2,
                                color: '#5c8e26'
                            }
                        }
                    }
                },
                {
                    name: '2P_单节点_分区表_1H',
                    type: 'line',
                    data: dot_res[5][6],
                    symbolSize: 5,
                    symbol: 'none',
                    itemStyle: {
                        normal: {
                            label: {
                                show: true
                            },
                            borderColor: 'gray',
                            color: '#00CC00',
                            lineStyle: {
                                width: 2,
                                color: '#00CC00'
                            }
                        }
                    }
                },
                {
                    name: '2P_一主一备_分区表_1H',
                    type: 'line',
                    data: dot_res[1][6],
                    symbolSize: 5,
                    symbol: 'none',
                    itemStyle: {
                        normal: {
                            label: {
                                show: true
                            },
                            borderColor: 'gray',
                            color: '#4f81bd',
                            lineStyle: {
                                width: 2,
                                color: '#4f81bd'
                            }
                        }
                    }
                },
                {
                    name: '2P_一主一备_非分区表_1H',
                    type: 'line',
                    data: dot_res[2][6],
                    symbolSize: 5,
                    symbol: 'none',
                    itemStyle: {
                        normal: {
                            label: {
                                show: true
                            },
                            borderColor: 'gray',
                            color: '#00BBFF',
                            lineStyle: {
                                width: 2,
                                color: '#00BBFF'
                            }
                        }
                    }
                },
                {
                    name: '5220_单节点_1H',
                    type: 'line',
                    data: dot_res[3][6],
                    symbolSize: 5,
                    symbol: 'none',
                    itemStyle: {
                        normal: {
                            label: {
                                show: true
                            },
                            borderColor: 'gray',
                            color: '#8A2BE2',
                            lineStyle: {
                                width: 2,
                                color: '#8A2BE2'
                            }
                        }
                    }
                },
                {
                    name: '4P_单节点_1H',
                    type: 'line',
                    data: dot_res[4][6],
                    symbolSize: 5,
                    symbol: 'none',
                    itemStyle: {
                        normal: {
                            label: {
                                show: true
                            },
                            borderColor: 'gray',
                            color: '#FFDAB9',
                            lineStyle: {
                                width: 2,
                                color: '#FFDAB9'
                            }
                        }
                    }
                }]
            };
            myDotChart.clear();
            myDotChart.setOption(dot_chart_option);
        })

        $.get("{% url 'perf_resource' %}", function(data,status){
            console.log(data)
            var cpu_res = JSON.parse(data);
            var cpu_res_us = cpu_res[0]
            var cpu_res_sy = cpu_res[1]
            var newLineChart = document.getElementById('cpu');
            var myLineChart = echarts.init(newLineChart);
            var cpu_res_us_pair = [];
            var cpu_res_sy_pair = [];
            var core = [];
            for(var i=0;i<cpu_res_us.length;i++){
                core[i] = i.toString();
                cpu_res_us_pair[i] = cpu_res_us[i];
                cpu_res_sy_pair[i] = cpu_res_sy[i];
            }
            console.log(core)
            var line_chart_option = {
                title: {
                    text: 'CPU利用率',
                    x: 'center',
                    y: 'top',
                },
                tooltip: {
                    trigger: 'axis',
                },
                legend: {
                    x: 'right',
                    y: '7%',
                    data: ['cpu_sy', 'cpu_us'],
                },
                xAxis: [
                    {
                        type: 'category',
                        name: 'core',
                        data: core,
                        axisPointer: { //设置指示器类型
                            type: 'shadow'
                        },
                    }
                ],
                yAxis: [
                    {
                        name: "CPU利用率",
                        type: 'value',
                        min: 0,
                        max:100,
                    }
                ],
                series: [
                    {
                        name: 'cpu_us',
                        type: 'bar',
                        stack:"cpu_total",  // 数据堆叠，必须添加相同的stack属性
                        data: cpu_res_us_pair,
                        itemStyle:{
                            color:"#277eab"
                        }
                    },
                    {
                        name: 'cpu_sy',
                        type: 'bar',
                        stack:"cpu_total",
                        data: cpu_res_sy_pair,
                        itemStyle:{
                            color:"#8bb4fb"
                        }
                    }
                ]
            };
            myLineChart.clear();
            myLineChart.setOption(line_chart_option);
        })

        $.get("{% url 'get_tpch_data' %}", function(data,status){
            var sql_res = JSON.parse(data);
            date_id = sql_res['rows'].length - 1
            no_data = "no record!"
            var date_version_one = no_data
            var date_version_two = no_data
            var date_version_three = no_data
            var date_version_pg = no_data
            date_version = [date_version_one, date_version_two,
                            date_version_three, date_version_pg]
            for(var i=0;i<sql_res['date_version'].length;i++){
                date_version[i] = sql_res['date_version'][i];
            }
            var end_id = sql_res['date_version'].length - 1
            date_version[3] = sql_res['date_version'][end_id]
            var data_content = sql_res['rows']
            var columns = [
                [{
                    field: "id_seq",
                    title: "序号",
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    colspan : 1,
                    rowspan : 2,
                },{
                    field: "sql_statement",
                    title: "sql语句",
                    align: 'center',
                    width: "45%",
                    sortable: false,
                    colspan : 1,
                    rowspan : 2,
                    formatter: function (value, row, index) {
                        var cur_datas = data_content[index]
                        sql_explain = cur_datas.sql_explain
                        sql_statement = cur_datas.sql_statement
                        if (sql_explain == null) {
                            return "<div style=\"font-family:'微软雅黑'\" title=\"no explain\">"
                                + sql_statement + "</div>";
                        }
                        title_content = sql_statement + "&#10;" + sql_explain
                        return "<div style=\"font-family:'微软雅黑'\" title=\""
                               + title_content + "\">"
                               + sql_statement.substring(0,150) + "</div>";
                    }
                },{
                    title: date_version[3],
                    align: 'center',
                    width: "12%",
                    sortable: false,
                    colspan : 1,
                },{
                    title: date_version[0],
                    align: 'center',
                    width: "12%",
                    sortable: false,
                    colspan : 1,
                },{
                    title: date_version[1],
                    align: 'center',
                    width: "12%",
                    sortable: false,
                    colspan : 1,
                },{
                    title: date_version[2],
                    align: 'center',
                    width: "12%",
                    sortable: false,
                    colspan : 1,
                }],
                [{
                    field: "execute_time_pg",
                    title: "PG-运行时间(s)",
                    align: 'center',
                    valign: 'middle',
                    sortable: false,
                    formatter: function (value, row, index) {
                        var cur_datas = data_content[index]
                        time_pg = cur_datas.execute_time_pg
                        if (time_pg == 0) {
                            return "<div style=\"font-family:'微软雅黑'\">"
                                + "no record</div>";
                        }
                        var explain_pg = cur_datas.explain_pg
                        if (explain_pg != null) {
                            explain_pg = explain_pg.replaceAll("'", "&#39;")
                            explain_pg = explain_pg.replaceAll("\"", "&#34;")
                            explain_pg = explain_pg.replaceAll("\n", "&#10;")
                            explain_pg = explain_pg.replaceAll("<", "&#60;")
                            explain_pg = explain_pg.replaceAll(">", "&#62;")
                        }
                        explain_pg = "&#34;" + explain_pg + "&#34;"
                        return "<div style=\"font-family:'微软雅黑'\" title=\""
                               + explain_pg + "\">" + time_pg + "</div>";
                    }
                },{
                    field: "execute_time_one",
                    title: "OG-运行时间(s)",
                    align: 'center',
                    valign: 'middle',
                    sortable: false,
                    formatter: function (value, row, index) {
                        var cur_datas = data_content[index]
                        time_og_one = cur_datas.execute_time_one
                        if (time_og_one == 0) {
                            return "<div style=\"font-family:'微软雅黑'\">"
                                + "no record</div>";
                        }
                        if (time_og_one >= time_pg) {
                            var percent = ((time_og_one - time_pg) / time_pg
                                          * 100).toFixed(2)
                            time_og_one = time_og_one + " (↓" + percent + "%)"
                            color = "red"
                        } else {
                            var percent = ((time_pg - time_og_one) / time_pg
                                          * 100).toFixed(2)
                            time_og_one = time_og_one + " (↑" + percent + "%)"
                            color = "green"
                        }
                        var explain_one = cur_datas.explain_one
                        if (explain_one != null) {
                            explain_one = explain_one.replaceAll("'", "&#39;")
                            explain_one = explain_one.replaceAll("\"", "&#34;")
                            explain_one = explain_one.replaceAll("\n", "&#10;")
                            explain_one = explain_one.replaceAll("<", "&#60;")
                            explain_one = explain_one.replaceAll(">", "&#62;")
                        }
                        explain_one = "&#34;" + explain_one + "&#34;"
                        return "<div style=\"font-family:'微软雅黑'\" title=\""
                               + explain_one +"\"> <a style=\"color:" + color + "\">" + time_og_one + "</a> </div>";
                    }
                },{
                    field: "execute_time_two",
                    title: "OG-运行时间(s)",
                    align: 'center',
                    valign: 'middle',
                    sortable: false,
                    formatter: function (value, row, index) {
                        var cur_datas = data_content[index]
                        time_og_two = cur_datas.execute_time_two
                        if (time_og_two == 0) {
                            return "<div style=\"font-family:'微软雅黑'\">"
                                + "no record</div>";
                        }
                        if (time_og_two >= time_pg) {
                            var percent = ((time_og_two - time_pg) / time_pg
                                          * 100).toFixed(2)
                            time_og_two = time_og_two + " (↓" + percent + "%)"
                            color = "red"
                        } else {
                            var percent = ((time_pg - time_og_two) / time_pg
                                          * 100).toFixed(2)
                            time_og_two = time_og_two + " (↑" + percent + "%)"
                            color = "green"
                        }
                        var explain_two = cur_datas.explain_two
                        if (explain_two != null) {
                            explain_two = explain_two.replaceAll("'", "&#39;")
                            explain_two = explain_two.replaceAll("\"", "&#34;")
                            explain_two = explain_two.replaceAll("\n", "&#10;")
                        }
                        return "<div style=\"font-family:'微软雅黑'\" title=\""
                               + explain_two +"\"> <a style=\"color:" + color + "\">" + time_og_two + "</a> </div>";
                    }
                },{
                    field: "execute_time_three",
                    title: "OG-运行时间(s)",
                    align: 'center',
                    valign: 'middle',
                    sortable: false,
                    formatter: function (value, row, index) {
                        var cur_datas = data_content[index]
                        time_og_three = cur_datas.execute_time_three
                        if (time_og_three == 0) {
                            return "<div style=\"font-family:'微软雅黑'\">"
                                + "no record</div>";
                        }
                        if (time_og_three >= time_pg) {
                            var percent = ((time_og_three - time_pg) / time_pg
                                          * 100).toFixed(2)
                            time_og_three = time_og_three + " (↓" + percent + "%)"
                            color = "red"
                        } else {
                            var percent = ((time_pg - time_og_three) / time_pg
                                          * 100).toFixed(2)
                            time_og_three = time_og_three + " (↑" + percent + "%)"
                            color = "green"
                        }
                        var explain_three = cur_datas.explain_three
                        if (explain_three != null) {
                            explain_three = explain_three.replaceAll("'", "&#39;")
                            explain_three = explain_three.replaceAll("\"", "&#34;")
                            explain_three = explain_three.replaceAll("\n", "&#10;")
                            explain_three = explain_three.replaceAll("<", "&#60;")
                            explain_three = explain_three.replaceAll(">", "&#62;")
                        }
                        return "<div style=\"font-family:'微软雅黑'\" title=\""
                               + explain_three +"\"> <a style=\"color:" + color + "\">" + time_og_three + "</a> </div>";
                    }
                }]];
            var sql_table_tpch = $("#sql_table_tpch");
            sql_table_tpch.bootstrapTable("destroy").bootstrapTable({
                data:data_content,
                columns: columns,
                cache: false,
            });
        })

        $.get("{% url 'get_sqlperf_data' %}", function(data,status){
            var sql_res = JSON.parse(data);
            date_id = sql_res['rows'].length - 1
            no_data = "no record!"
            var date_version_one = no_data
            var date_version_two = no_data
            var date_version_three = no_data
            var date_version_pg = no_data
            date_version = [date_version_one, date_version_two,
                            date_version_three, date_version_pg]
            for(var i=0;i<sql_res['date_version'].length - 1;i++){
                date_version[i] = sql_res['date_version'][i];
            }
            var end_id = sql_res['date_version'].length - 1
            date_version[3] = sql_res['date_version'][end_id]
            var data_content = sql_res['rows']
            var columns = [
                [{
                    field: "id_seq",
                    title: "序号",
                    align: 'center',
                    width: "0.8%",
                    sortable: false,
                    colspan : 1,
                    rowspan : 2,
                },{
                    field: "exec_wrap",
                    title: "算子类别",
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    colspan : 1,
                    rowspan : 2,
	            formatter: function (value, row, index) {
                        value=value.replaceAll(/\n/ig,"<br/>")
                        return value
                    }
                },{
                    field: "sql_statement",
                    title: "sql语句",
                    align: 'center',
                    width: "10%",
                    sortable: false,
                    colspan : 1,
                    rowspan : 2,
                },{
                    title: date_version[3],
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    colspan : 1,
                },{
                    title: date_version[2],
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    colspan : 1,
                },{
                    title: date_version[1],
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    colspan : 1,
                },{
                    title: date_version[0],
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    colspan : 1,
                }],
                [{
                    field: "execute_time_pg",
                    title: "PG-运行时间(ms)",
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    formatter: function (value, row, index) {
                        var pg_explain = data_content[index].explain_pg
                        if (pg_explain != null) {
                            pg_explain = pg_explain.replaceAll("'", "&#39;")
                        }
                        return "<div style=\"font-family:'微软雅黑'\" title='"
                               + pg_explain + "'><a style=\"color: #000;\">"
                               + value + "</a></div>";
                    }
                },{
                    field: "execute_time_three",
                    title: "OG-运行时间(ms)",
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    formatter: function (value, row, index) {
                        var cur_datas = data_content[index]
                        var time_og_three = typeof (cur_datas.execute_time_three)
                            == "undefined" ? 0 : cur_datas.execute_time_three
                        var time_pg = typeof (cur_datas.execute_time_pg)
                            == "undefined" ? 0 : cur_datas.execute_time_pg
                        if (time_og_three == 0) {
                            return "<div style=\"font-family:'微软雅黑'\">"
                                   + "no record</div>";
                        }
                        if (time_og_three > time_pg) {
                            var percent = ((time_og_three - time_pg) / time_pg
                                          * 100).toFixed(2)
                            value = value + " (↓" + percent + "%)"
                            color = "red"
                        } else {
                            var percent = ((time_pg - time_og_three) / time_pg
                                          * 100).toFixed(2)
                            value = value + " (↑" + percent + "%)"
                            color = "green"
                        }
                        var explain_three = cur_datas.explain_three
                        if (explain_three != null) {
                            explain_three = explain_three.replaceAll("'", "&#39;")
                        }
                        return "<div style=\"font-family:'微软雅黑'\" title='"
                               + explain_three + "'><a style=\"color: "
                               + color + "\">" + value + "</a></div>";
                    },
                },{
                    field: "execute_time_two",
                    title: "OG-运行时间(ms)",
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    formatter: function (value, row, index) {
                        var cur_datas = data_content[index]
                        var time_og_two = typeof (cur_datas.execute_time_two)
                            == "undefined" ? 0 : cur_datas.execute_time_two
                        var time_pg = typeof (cur_datas.execute_time_pg)
                            == "undefined" ? 0 : cur_datas.execute_time_pg
                        if (time_og_two == 0) {
                            return "<div style=\"font-family:'微软雅黑'\">"
                                   + "no record</div>";
                        }
                        if (time_og_two > time_pg) {
                            var percent = ((time_og_two - time_pg) / time_pg
                                          * 100).toFixed(2)
                            value = value + " (↓" + percent + "%)"
                            color = "red"
                        } else {
                            var percent = ((time_pg - time_og_two) / time_pg
                                          * 100).toFixed(2)
                            value = value + " (↑" + percent + "%)"
                            color = "green"
                        }
                        var explain_two = cur_datas.explain_two
                        if (explain_two != null) {
                            explain_two = explain_two.replaceAll("'", "&#39;")
                        }
                        return "<div style=\"font-family:'微软雅黑'\" title='"
                               + explain_two + "'><a style=\"color: " + color
                               + "\">" + value + "</a></div>";
                    }
                },{
                    field: "execute_time_one",
                    title: "OG-运行时间(ms)",
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    formatter: function (value, row, index) {
                        var cur_datas = data_content[index]
                        var time_og_one = typeof (cur_datas.execute_time_one)
                            == "undefined" ? 0 : cur_datas.execute_time_one
                        var time_pg = typeof (cur_datas.execute_time_pg)
                            == "undefined" ? 0 : cur_datas.execute_time_pg
                        if (time_og_one == 0) {
                            return "<div style=\"font-family:'微软雅黑'\">"
                                   + "no record</div>";
                        }
                        if (time_og_one >= time_pg) {
                            var percent = ((time_og_one - time_pg) / time_pg
                                          * 100).toFixed(2)
                            value = value + " (↓" + percent + "%)"
                            color = "red"
                        } else {
                            var percent = ((time_pg - time_og_one) / time_pg
                                          * 100).toFixed(2)
                            value = value + " (↑" + percent + "%)"
                            color = "green"
                        }
                        var explain_one = cur_datas.explain_one
                        if (explain_one != null) {
                            explain_one = explain_one.replaceAll("'", "&#39;")
                        }
                        return "<div style=\"font-family:'微软雅黑'\" title='"
                               + explain_one + "'><a style=\"color: " + color
                               + "\">" + value + "</a></div>";
                    }
                }]];
            var sql_table = $("#sql_table");
            sql_table.bootstrapTable({
                    data:data_content,
                    columns: columns,
            });

            //折线图
            var newLineChart = document.getElementById('sql_simple_line');
            var myLineChart = echarts.init(newLineChart);
            var x_data = [];
            var s_data = [];
            var legend = [];
            for (var dind = 0; dind < date_version.length - 1; dind++) {
                each_date = date_version[dind]
                x_data[dind] = each_date.split(" ")[0]
            }
            for (var ind = 0; ind < data_content.length; ind++) {
                var cur_datas = data_content[ind]
                var time_og_one = typeof (cur_datas.execute_time_one)
                    == "undefined" ? 0 : cur_datas.execute_time_one
                var time_og_two = typeof (cur_datas.execute_time_two)
                    == "undefined" ? 0 : cur_datas.execute_time_two
                var time_og_three = typeof (cur_datas.execute_time_three)
                    == "undefined" ? 0 : cur_datas.execute_time_three
                var y_data = [time_og_three, time_og_two, time_og_one]

                legend[ind] = "sql" + (ind + 1)
                s_temp = {
                    name: legend[ind],
                    type: "line",
                    symbolSize: 5,
                    symbol: 'circle',
                    data: y_data,
                };
                s_data.push(s_temp)
            }

            var line_chart_option = {
                title: {
                    text: 'sql简单算子-openGauss不同版本对比',
                    x: 'center',
                    y: 'top',
                },
                grid: {
                    top: '18%'
                },
                tooltip: {
                    trigger: 'axis',
                    formatter: function(arg) {
                        cur_exe_time = arg[0].data
                        cur_exe_time_ind = arg[0].dataIndex
                        var percent = 0
                        if (cur_exe_time_ind > 0) {
                            sql_ind = arg[0].componentIndex
                            data_list = s_data[sql_ind].data
                            pre_exe_time = data_list[cur_exe_time_ind - 1]
                            percent = Math.abs(cur_exe_time - pre_exe_time) / pre_exe_time * 100

                            compare_str = "<br>"
                            if (cur_exe_time > pre_exe_time) {
                                compare_str = compare_str + "<div style=\"font-family:'微软雅黑';\">"
                                              + "较前一次数据：<span style=\"font-weight:bold; color:#ff3300\">劣化 "
                                              + percent.toFixed(2) + "%</span></div>"
                            } else {
                                compare_str = compare_str + "<div style=\"font-family:'微软雅黑';\">"
                                              + "较前一次数据：<span style=\"font-weight:bold; color:#33ff00\">优化 "
                                              + percent.toFixed(2) + "%</span></div>"
                            }
                            return arg[0].name + '<br>执行时间：' + arg[0].data + compare_str
                        }
                        return arg[0].name + '<br>执行时间：' + arg[0].data + "<br>"
                    }
                },
                legend: {
                    type: 'scroll',
                    orient: 'vertical',
                    right: 10,
                    top: 50,
                    bottom: 80,
                    selectedMode: 'single',
                    data: legend
                },
                xAxis: {
                    name: '日期',
                    type: 'category',
                    data: x_data.reverse(),
                    axisLabel: {
                        rotate: 0,
                        interval: 0
                    }
                },
                yAxis: {
                    name: '运行时间',
                    type: 'value',
                },
                series:s_data
            };
            myLineChart.clear();
            myLineChart.setOption(line_chart_option);
        })

        $.get("{% url 'get_sqlperf_data_yukon' %}", function(data,status){
            var sql_res = JSON.parse(data);
            date_id = sql_res['rows'].length - 1
            no_data = "chaotu no record!"
            var date_version_one = no_data
            var date_version_two = no_data
            var date_version_three = no_data
            var date_version_pg = no_data
            data_version = [date_version_one, date_version_two,
                            date_version_three, date_version_pg]
            for(var i=0;i<sql_res['date_version'].length - 1;i++){
                data_version[i] = sql_res['date_version'][i];
            }
            var end_id = sql_res['date_version'].length - 1
            data_version[3] = sql_res['date_version'][end_id]
            var data_content = sql_res['rows']
            var columns = [
                [{
                    field: "id_seq",
                    title: "序号",
                    align: 'center',
                    width: "0.8%",
                    sortable: false,
                    colspan : 1,
                    rowspan : 2,
                },{
                    field: "sql_statement",
                    title: "sql语句",
                    align: 'center',
                    width: "30%",
                    sortable: false,
                    colspan : 1,
                    rowspan : 2,
                    formatter: function (value, row, index) {
                        if (value.length > 200) {
                            return "<div style=\"font-family:'微软雅黑'\" title='"
                                   + value + "'><a style=\"color: #000;\">"
                                   + value.substring(0,50) + "...</a></div>";
                        } else {
                            new_value=value.replaceAll(/\n/ig,"<br/>")
                            return new_value
                        }
                    }
                },{
                    title: data_version[3],
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    colspan : 1,
                },{
                    title: data_version[0],
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    colspan : 1,
                },{
                    title: data_version[1],
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    colspan : 1,
                },{
                    title: data_version[2],
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    colspan : 1,
                }],
                [{
                    field: "execute_time_pg",
                    title: "PG-运行结果(tps)",
                    align: 'center',
                    width: "2%",
                    sortable: false,
                    formatter: function (value, row, index) {
	                var pg_explain = data_content[index].explain_pg
                        if (pg_explain != null) {
                            pg_explain = pg_explain.replaceAll("'", "&#39;")
                        }
                        return "<div style=\"font-family:'微软雅黑'\" title='"
                               + pg_explain + "'><a style=\"color: #000;\">"
                               + value + "</a></div>";
                    }
                },{
                    field: "execute_time_one",
                    title: "OG-运行结果(tps)",
                    align: 'center',
                    width: "2%",
                    sortable: false,
                    formatter: function (value, row, index) {
                        var cur_datas = data_content[index]
                        var time_og_one = typeof (cur_datas.execute_time_one)
                            == "undefined" ? 0 : cur_datas.execute_time_one
                        var time_pg = typeof (cur_datas.execute_time_pg)
                            == "undefined" ? 0 : cur_datas.execute_time_pg
                        if (time_og_one == 0) {
                            return "<div style=\"font-family:'微软雅黑'\">"
                                   + "no record</div>";
                        }
                        if (time_og_one >= time_pg) {
                            var percent = ((time_og_one - time_pg) / time_pg
                                          * 100).toFixed(2)
                            value = value + " (↑" + percent + "%)"
                            color = "green"
                        } else {
                            var percent = ((time_pg - time_og_one) / time_pg
                                        * 100).toFixed(2)
                            value = value + " (↓" + percent + "%)"
                            color = "red"
                        }
                        var explain_one = cur_datas.explain_one
                        if (explain_one != null) {
                            explain_one = explain_one.replaceAll("'", "&#39;")
                        }
                        return "<div style=\"font-family:'微软雅黑'\" title='"
                               + explain_one + "'><a style=\"color: " + color
                               + "\">" + value + "</a></div>";
                    }
                },{
                    field: "execute_time_two",
                    title: "OG-运行结果(tps)",
                    align: 'center',
                    width: "2%",
                    sortable: false,
                    formatter: function (value, row, index) {
                        var cur_datas = data_content[index]
                        var time_og_two = typeof (cur_datas.execute_time_two)
                            == "undefined" ? 0 : cur_datas.execute_time_two
                        var time_pg = typeof (cur_datas.execute_time_pg)
                            == "undefined" ? 0 : cur_datas.execute_time_pg
                        if (time_og_two == 0) {
                            return "<div style=\"font-family:'微软雅黑'\">"
                                   + "no record</div>";
                        }
                        if (time_og_two >= time_pg) {
                            var percent = ((time_og_two - time_pg) / time_pg
                                          * 100).toFixed(2)
                            value = value + " (↑" + percent + "%)"
                            color = "green"
                        } else {
                            var percent = ((time_pg - time_og_two) / time_pg
                                          * 100).toFixed(2)
                            value = value + " (↓" + percent + "%)"
                            color = "red"
                        }
                        var explain_two = cur_datas.explain_two
                        if (explain_two != null) {
                            explain_two = explain_two.replaceAll("'", "&#39;")
                        }
                        return "<div style=\"font-family:'微软雅黑'\" title='"
                               + explain_two + "'><a style=\"color: " + color
                               + "\">" + value + "</a></div>";
                    }
                },{
                    field: "execute_time_three",
                    title: "OG-运行结果(tps)",
                    align: 'center',
                    width: "2%",
                    sortable: false,
                    formatter: function (value, row, index) {
                        var cur_datas = data_content[index]
                        var time_og_three = typeof (cur_datas.execute_time_three)
                            == "undefined" ? 0 : cur_datas.execute_time_three
                        var time_pg = typeof (cur_datas.execute_time_pg)
                            == "undefined" ? 0 : cur_datas.execute_time_pg
                        if (time_og_three == 0) {
                            return "<div style=\"font-family:'微软雅黑'\">"
                                   + "no record</div>";
                        }
                        if (time_og_three >= time_pg) {
                            var percent = ((time_og_three - time_pg) / time_pg
                                          * 100).toFixed(2)
                            value = value + " (↑" + percent + "%)"
                            color = "green"
                        } else {
                            var percent = ((time_pg - time_og_three) / time_pg
                                          * 100).toFixed(2)
                            value = value + " (↓" + percent + "%)"
                            color = "red"
                        }
                        var explain_three = cur_datas.explain_three
                        if (explain_three != null) {
                            explain_three = explain_three.replaceAll("'", 
                                                "&#39;")
                        }
                        return "<div style=\"font-family:'微软雅黑'\" title='"
                               + explain_three + "'><a style=\"color: "
                               + color + "\">" + value + "</a></div>";
                    }
                }]];
            var sql_table_chaotu = $("#sql_table_chaotu");
            sql_table_chaotu.bootstrapTable({
                    data:data_content,
                    columns: columns,
            });
        })

        $.get("{% url 'get_migrate_perf_data' %}", {migrate_type: "full_migrate"}, function(data,status){
            var sql_res = JSON.parse(data);
            no_data = "no record!"
            var date_version_one = no_data
            var date_version_two = no_data
            var date_version_three = no_data
            date_version = [date_version_one, date_version_two,
                            date_version_three]
            for(var i=0;i<sql_res['date_version'].length;i++){
                date_version[i] = sql_res['date_version'][i];
            }
            var full_base = 300
            var data_content = sql_res['rows']
            var columns = [
                [{
                    field: "scene_type",
                    title: "数据场景",
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    colspan : 1,
                    rowspan : 2,
                },{
                    title: date_version[2],
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    colspan : 1,
                },{
                    title: date_version[1],
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    colspan : 1,
                },{
                    title: date_version[0],
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    colspan : 1,
                }],
                [{
                    field: "speed_three",
                    title: "全量迁移性能(tps)",
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    formatter: function (value, row, index) {
                        if (value < full_base) {
                            var percent = ((full_base - value) / full_base
                                          * 100).toFixed(2)
                            value = value + " (↓" + percent + "%)"
                            color = "red"
                        } else {
                            var percent = ((value - full_base) / full_base
                                          * 100).toFixed(2)
                            value = value + " (↑" + percent + "%)"
                            color = "green"
                        }
                        return "<div style=\"font-family:'微软雅黑'\">"
                               + "<a style=\"color: " + color + "\">" + value + "</a></div>";
                    },
                },{
                    field: "speed_two",
                    title: "全量迁移性能(tps)",
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    formatter: function (value, row, index) {
                        if (value < full_base) {
                            var percent = ((full_base - value) / full_base
                                          * 100).toFixed(2)
                            value = value + " (↓" + percent + "%)"
                            color = "red"
                        } else {
                            var percent = ((value - full_base) / full_base
                                          * 100).toFixed(2)
                            value = value + " (↑" + percent + "%)"
                            color = "green"
                        }
                        return "<div style=\"font-family:'微软雅黑'\">"
                               + "<a style=\"color: " + color + "\">" + value + "</a></div>";
                    },
                },{
                    field: "speed_one",
                    title: "全量迁移性能(tps)",
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    formatter: function (value, row, index) {
                        if (value < full_base) {
                            var percent = ((full_base - value) / full_base
                                          * 100).toFixed(2)
                            value = value + " (↓" + percent + "%)"
                            color = "red"
                        } else {
                            var percent = ((value - full_base) / full_base
                                          * 100).toFixed(2)
                            value = value + " (↑" + percent + "%)"
                            color = "green"
                        }
                        return "<div style=\"font-family:'微软雅黑'\">"
                               + "<a style=\"color: " + color + "\">" + value + "</a></div>";
                    },
                }]];
            var trans_full_table = $("#trans_table_full");
            trans_full_table.bootstrapTable({
                    data:data_content,
                    columns: columns,
            });
        })

        $.get("{% url 'get_migrate_perf_data' %}", {migrate_type: "incre_migrate"}, function(data,status){
            var sql_res = JSON.parse(data);
            no_data = "no record!"
            var date_version_one = no_data
            var date_version_two = no_data
            var date_version_three = no_data
            date_version = [date_version_one, date_version_two,
                            date_version_three]
            for(var i=0;i<sql_res['date_version'].length;i++){
                date_version[i] = sql_res['date_version'][i];
            }
            var incre_base = 30000
            var data_content = sql_res['rows']
            var columns = [
                [{
                    field: "scene_type",
                    title: "数据场景",
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    colspan : 1,
                    rowspan : 2,
                },{
                    title: date_version[2],
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    colspan : 1,
                },{
                    title: date_version[1],
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    colspan : 1,
                },{
                    title: date_version[0],
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    colspan : 1,
                }],
                [{
                    field: "speed_three",
                    title: "增量迁移性能(tps)",
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    formatter: function (value, row, index) {
                        if (value < incre_base) {
                            var percent = ((incre_base - value) / incre_base
                                          * 100).toFixed(2)
                            value = value + " (↓" + percent + "%)"
                            color = "red"
                        } else {
                            var percent = ((value - incre_base) / incre_base
                                          * 100).toFixed(2)
                            value = value + " (↑" + percent + "%)"
                            color = "green"
                        }
                        return "<div style=\"font-family:'微软雅黑'\">"
                               + "<a style=\"color: " + color + "\">" + value + "</a></div>";
                    },
                },{
                    field: "speed_two",
                    title: "增量迁移性能(tps)",
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    formatter: function (value, row, index) {
                        if (value < incre_base) {
                            var percent = ((incre_base - value) / incre_base
                                          * 100).toFixed(2)
                            value = value + " (↓" + percent + "%)"
                            color = "red"
                        } else {
                            var percent = ((value - incre_base) / incre_base
                                          * 100).toFixed(2)
                            value = value + " (↑" + percent + "%)"
                            color = "green"
                        }
                        return "<div style=\"font-family:'微软雅黑'\">"
                               + "<a style=\"color: " + color + "\">" + value + "</a></div>";
                    },
                },{
                    field: "speed_one",
                    title: "增量迁移性能(tps)",
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    formatter: function (value, row, index) {
                        if (value < incre_base) {
                            var percent = ((incre_base - value) / incre_base
                                          * 100).toFixed(2)
                            value = value + " (↓" + percent + "%)"
                            color = "red"
                        } else {
                            var percent = ((value - incre_base) / incre_base
                                          * 100).toFixed(2)
                            value = value + " (↑" + percent + "%)"
                            color = "green"
                        }
                        return "<div style=\"font-family:'微软雅黑'\">"
                               + "<a style=\"color: " + color + "\">" + value + "</a></div>";
                    },
                }]];
            var trans_incre_table = $("#trans_table_incre");
            trans_incre_table.bootstrapTable({
                    data:data_content,
                    columns: columns,
            });
        })

        $.get("{% url 'get_migrate_perf_data' %}", {migrate_type: "reverse_migrate"}, function(data,status){
            var sql_res = JSON.parse(data);
            no_data = "no record!"
            var date_version_one = no_data
            var date_version_two = no_data
            var date_version_three = no_data
            date_version = [date_version_one, date_version_two,
                            date_version_three]
            for(var i=0;i<sql_res['date_version'].length;i++){
                date_version[i] = sql_res['date_version'][i];
            }
            var reverse_base = 10000
            var data_content = sql_res['rows']
            var columns = [
                [{
                    field: "scene_type",
                    title: "数据场景",
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    colspan : 1,
                    rowspan : 2,
                },{
                    title: date_version[2],
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    colspan : 1,
                },{
                    title: date_version[1],
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    colspan : 1,
                },{
                    title: date_version[0],
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    colspan : 1,
                }],
                [{
                    field: "speed_three",
                    title: "反向迁移性能(tps)",
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    formatter: function (value, row, index) {
                        if (value < reverse_base) {
                            var percent = ((reverse_base - value) / reverse_base
                                          * 100).toFixed(2)
                            value = value + " (↓" + percent + "%)"
                            color = "red"
                        } else {
                            var percent = ((value - reverse_base) / reverse_base
                                          * 100).toFixed(2)
                            value = value + " (↑" + percent + "%)"
                            color = "green"
                        }
                        return "<div style=\"font-family:'微软雅黑'\">"
                               + "<a style=\"color: " + color + "\">" + value + "</a></div>";
                    },
                },{
                    field: "speed_two",
                    title: "反向迁移性能(tps)",
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    formatter: function (value, row, index) {
                        if (value < reverse_base) {
                            var percent = ((reverse_base - value) / reverse_base
                                          * 100).toFixed(2)
                            value = value + " (↓" + percent + "%)"
                            color = "red"
                        } else {
                            var percent = ((value - reverse_base) / reverse_base
                                          * 100).toFixed(2)
                            value = value + " (↑" + percent + "%)"
                            color = "green"
                        }
                        return "<div style=\"font-family:'微软雅黑'\">"
                               + "<a style=\"color: " + color + "\">" + value + "</a></div>";
                    },
                },{
                    field: "speed_one",
                    title: "反向迁移性能(tps)",
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    formatter: function (value, row, index) {
                        if (value < reverse_base) {
                            var percent = ((reverse_base - value) / reverse_base
                                          * 100).toFixed(2)
                            value = value + " (↓" + percent + "%)"
                            color = "red"
                        } else {
                            var percent = ((value - reverse_base) / reverse_base
                                          * 100).toFixed(2)
                            value = value + " (↑" + percent + "%)"
                            color = "green"
                        }
                        return "<div style=\"font-family:'微软雅黑'\">"
                               + "<a style=\"color: " + color + "\">" + value + "</a></div>";
                    },
                }]];
            var trans_reverse_table = $("#trans_table_reverse");
            trans_reverse_table.bootstrapTable({
                    data:data_content,
                    columns: columns,
            });
        })

        $.get("{% url 'get_migrate_perf_data' %}", {migrate_type: "full_datacheck"}, function(data,status){
            var sql_res = JSON.parse(data);
            no_data = "no record!"
            var date_version_one = no_data
            var date_version_two = no_data
            var date_version_three = no_data
            date_version = [date_version_one, date_version_two,
                            date_version_three]
            for(var i=0;i<sql_res['date_version'].length;i++){
                date_version[i] = sql_res['date_version'][i];
            }
            var check_base = 70
            var data_content = sql_res['rows']
            var columns = [
                [{
                    field: "scene_type",
                    title: "数据场景",
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    colspan : 1,
                    rowspan : 2,
                },{
                    title: date_version[2],
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    colspan : 1,
                },{
                    title: date_version[1],
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    colspan : 1,
                },{
                    title: date_version[0],
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    colspan : 1,
                }],
                [{
                    field: "speed_three",
                    title: "数据校验性能(MB/s)",
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    formatter: function (value, row, index) {
                        if (value < check_base) {
                            var percent = ((check_base - value) / check_base
                                          * 100).toFixed(2)
                            value = value + " (↓" + percent + "%)"
                            color = "red"
                        } else {
                            var percent = ((value - check_base) / check_base
                                          * 100).toFixed(2)
                            value = value + " (↑" + percent + "%)"
                            color = "green"
                        }
                        return "<div style=\"font-family:'微软雅黑'\">"
                               + "<a style=\"color: " + color + "\">" + value + "</a></div>";
                    },
                },{
                    field: "speed_two",
                    title: "数据校验性能(MB/s)",
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    formatter: function (value, row, index) {
                        if (value < check_base) {
                            var percent = ((check_base - value) / check_base
                                          * 100).toFixed(2)
                            value = value + " (↓" + percent + "%)"
                            color = "red"
                        } else {
                            var percent = ((value - check_base) / check_base
                                          * 100).toFixed(2)
                            value = value + " (↑" + percent + "%)"
                            color = "green"
                        }
                        return "<div style=\"font-family:'微软雅黑'\">"
                               + "<a style=\"color: " + color + "\">" + value + "</a></div>";
                    },
                },{
                    field: "speed_one",
                    title: "数据校验性能(MB/s)",
                    align: 'center',
                    width: "5%",
                    sortable: false,
                    formatter: function (value, row, index) {
                        if (value < check_base) {
                            var percent = ((check_base - value) / check_base
                                          * 100).toFixed(2)
                            value = value + " (↓" + percent + "%)"
                            color = "red"
                        } else {
                            var percent = ((value - check_base) / check_base
                                          * 100).toFixed(2)
                            value = value + " (↑" + percent + "%)"
                            color = "green"
                        }
                        return "<div style=\"font-family:'微软雅黑'\">"
                               + "<a style=\"color: " + color + "\">" + value + "</a></div>";
                    },
                }]];
            var trans_table_datacheck = $("#trans_table_datacheck");
            trans_table_datacheck.bootstrapTable({
                    data:data_content,
                    columns: columns,
            });
        })
    })
</script>
{% endblock %}
</body>
</html>
